#include "fmc.h"


void GD32_EraseFlash( uint32_t start,uint32_t number)
{
    uint16_t i;
    fmc_unlock();
    for(i=0;i<number;i++)
    {
        fmc_page_erase( 0x08000000+start*GD32_PAGE_SIZE + GD32_PAGE_SIZE*i);
    }
    fmc_lock();
}

void GD32_Write_Flash(uint32_t saddr,uint32_t *wdata,uint32_t wnum)
{
    fmc_unlock();
    while(wnum)
    {
        fmc_word_program(saddr,*wdata);
        wnum-=4;
        saddr+=4;
    }
    fmc_lock();
}




